package com.chaosj.webmagic.dto.gushiwen;

import com.chaosj.webmagic.dto.SearchResponseDto;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.experimental.Accessors;

/**
 * @className: MingJuResponseDto
 * @description:
 * @author: caoyangjie
 * @date: 2021/8/11
 **/
public class MingJuResponseDto extends SearchResponseDto {

    @Override
    public void addObject(String... args) {
        addMingJu(args[0], args[1], args[2], args[3]);
    }

    public void addMingJu(String label, String labelTarget, String shuJi, String shuJiTarget){
        list.add(new MingJuDto(label, labelTarget, shuJi, shuJiTarget));
    }

    @Data
    @Accessors(chain = true)
    @AllArgsConstructor
    class MingJuDto{
        String label;
        String labelTarget;
        String shuJi;
        String shuJiTarget;

        @Override
        public String toString() {
            StringBuffer stringBuffer = new StringBuffer();
            stringBuffer.append("访问路径: ").append(shuJiTarget).append("\n");
            stringBuffer.append("来源书籍: ").append(shuJi).append("\n");
            stringBuffer.append("名言名句: ").append(label).append("\n");
            stringBuffer.append("****************************************************************\n");
            return stringBuffer.toString();
        }
    }
}
